package workflow;
import java.util.ArrayList;
import java.util.ListIterator;


public class ListaCircular <T>
{
  private ArrayList<T> elemento;
  private ListIterator<T> it;
  
  public ListaCircular()
  {
    elemento = new ArrayList<T>();
    
  }
  public void crearIterador()
  {
    it = elemento.listIterator();
  }
  public void agregar(T elem)
  {
    elemento.add(elem);
  }
 /* public void quitar(T elem)
  {
    it.remove(elem);
  }*/
  public T siguiente()
  {
   if((it.nextIndex())==(elemento.size()))
      {
        while(it.hasPrevious())
          {
             it.previous();
          }
        return it.next();
      }
    else
    {
      return it.next();
    }
  }
  
  public int size()
  {
    return elemento.size();
  }
}

